#!/bin/bash
for i in $( ls *.out | awk '{print substr($1,0,(length($1)-3))}' ); do
  echo "Running" $i
  SCRIPTFILE=$i".sl"
  OUTFILE=$i".out"
  RESULTFILE=$i".result"
  ../shil < $SCRIPTFILE > $RESULTFILE

  if !(diff $RESULTFILE $OUTFILE >/dev/null); then
    echo "...failed"
    echo "RESULT:"
    echo "------"
    cat $RESULTFILE
    echo "------"
    echo
    echo "EXPECTED:"
    echo "--------"
    cat $OUTFILE
    echo "--------"
    echo
  fi
done
